﻿using System.Runtime.InteropServices;
using ExcelDna.Integration.CustomUI;

namespace Cubicle.Excel.Shared
{
    [ComVisible(true)]
    public class CubicleRibbon : ExcelRibbon
    {

        private CustomTaskPane ctp;

        public CubicleRibbon()
        {
            ctp = CustomTaskPaneFactory.CreateCustomTaskPane(typeof(LogUserControl), "Cubicle Log");
            ctp.Visible = true;
            ctp.DockPosition = MsoCTPDockPosition.msoCTPDockPositionBottom;
            ctp.DockPositionStateChange += ctp_DockPositionStateChange;
        }

        public static void ctp_DockPositionStateChange(CustomTaskPane ctp)
        {
            LogUserControl ctrl = default(LogUserControl);
            ctrl = (LogUserControl)ctp.ContentControl;
        }

        public void OnShowLog(IRibbonControl control)
        {
            ctp.Visible = !ctp.Visible;
        }

    }
}
